package com.bw.zhuangao5___day002.Activity.Janewyer;

import android.os.Build;
import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

import com.blankj.utilcode.util.ToastUtils;
import com.bw.zhuangao5___day002.Fragment.Books.StandardGSYVideoYANG;
import com.bw.zhuangao5___day002.R;
import com.shuyu.gsyvideoplayer.GSYVideoManager;

public class Janewyer_WoredSimiActivity extends AppCompatActivity {

    private StandardGSYVideoYANG keke;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_janewyer__wored_simi);
        initView();
        keke.setUp( "https://txmov2.a.yximgs.com/upic/2020/06/12/13/BMjAyMDA2MTIxMzI3MDdfMTQ2ODUxMDQ0MF8zMDMzMjE0MjM0MV8xXzM=_b_B8618e143911d3d922df84e21cb73b2f8.mp4?&tag=1-1619506068-xpcwebprofile-0-3n2cbvsp5n-015521d427ac9567&clientCacheKey=3x94sb4jjj8u3kg_b.mp4&tt=b&di=7b7d7fb7&bp=14734",true,"主人主人主人主人我要!!!!");
        keke.setLooping(true);
        keke.startPlayLogic();
        keke.getBackButton().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ToastUtils.showShort("返回");
            }
        });
        keke.getFullscreenButton().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                keke.setNeedAutoAdaptation(true);
                keke.setIfCurrentIsFullscreen(true);
                keke.startWindowFullscreen(Janewyer_WoredSimiActivity.this,true,true);
            }
        });
    }

    @Override
    protected void onResume() {
        super.onResume();
        GSYVideoManager.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
        GSYVideoManager.onPause();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
      GSYVideoManager.releaseAllVideos();
    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        if (hasFocus && Build.VERSION.SDK_INT >= 20) {
            View decorView = getWindow().getDecorView();
            decorView.setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
        }
    }

    private void initView() {
        keke = findViewById(R.id.keke);
    }
}
